Music Object Extension - Callbacks

  Contents

About This Extension

Unlike the onLoad, onMetaEvent, onPause, onPlay, onReady, and onStop methods that provide the core Music Object API's callback support, these additional methods allow one to stack multiple event handlers for the same player event.

For example, while the onPlay method only allows one to override the currently registered handler for the play event, the addOnPlay method lets one add new handlers on top of currently registered handlers. Then, when a play event occurs for a Music Object instance, all handlers that have been added to the stack using the addOnPlay method will be executed in the order in which they were added to the stack. In fact, callback handlers that are added for any callback type are executed when the callback event occurs, and in the order in which they were added to the stack of callback handlers. Consider the following code example...

myMusicObject.addOnPlay (initialiseUI);
myMusicObject.addOnPlay ('fileStarted = true');
myMusicObject.addOnPlay ('preloadNextSong ("creepy-swamp.rmf")');

Now, when a play event occurs for myMusicObject, the initialiseUI function will first be called, then the statement fileStarted = true will be evaluated, and then the statement preloadNextSong ("creepy-swamp.rmf") will be evaluated. Of course, in this very straightforward situation one could simply have rolled all the actions into a single myOnPlayHandler function and registered this using the onPlay method, but the goal of the methods in this extension is to allow multiple code modules to add to the callback handler stack for any given callback type, without needing to worry about handlers that have already been registered by other code modules.

One of the things that this allows is for multiple code segments to cooperatively listen for events that occur within a shared Music Object instance, without these code modules having to have an intimate understanding of each other's internal implementation. Using the methods for managing callbacks that are provided in this extension, different code modules can use the callbacks for a Music Object instance without overriding each other's registered callback handlers, as would otherwise occur with the core Music Object callback methods.

Tip on Removing Callbacks

If a function, rather than a statement block, has been registered as a callback handler, then that callback handler can only be removed by specifying the original function that was registered as the callback handler, and not a statement block representing a call to the function. For instance, the following code will not work correctly...

  INCORRECT
function myOnPlayHandler () {
	// code to handle onPlay event
}

myMusicObject.addOnPlay (myOnPlayHandler);
myMusicObject.removeOnPlay ('myOnPlayHandler ()');

However, the code listed below is correct and the handler registered using the addOnPlay method is successfully removed using the removeOnPlay method.

  CORRECT
function myOnPlayHandler () {
	// code to handle onPlay event
}

myMusicObject.addOnPlay (myOnPlayHandler);
myMusicObject.removeOnPlay (myOnPlayHandler);

What's New in the Latest Version

There is a dedicated version history for this extension, where you will be able to find out about the new features and possible issues with the most recent version. The version history for this extension is independent of the version history for the core Music Object API.

Getting This Extension

To get the "music-object-x-callbacks.js" JavaScript file that implements this extension, simply right-click on this link (click-and-hold for Mac users). Then, from the menu that pops up, select the 'Save Link As...' or 'Save Target As...' option and save the file as "music-object-x-callbacks.js" into an appropriate folder of the local copy of your Web site.

In case you have problems saving the file using the above link, the "music-object-x-callbacks.js" file can also be found inside the documentation's "javascript" folder, along with the "music-object.js" file.

Dependencies

In order to use this extension, the following JavaScript file(s) must first be sourced in...

For more information on using extensions, consult the section About Music Object Extensions.

Reference

The instance methods provided in this module are listed in the table below and are divided into three groups: Adding Event Handlers, Clearing Event Handlers, and Removing Event Handlers. Removing event handlers is different to clearing event handlers, in that one can remove very specific handlers that have been registered, whereas clearing will clear all event handlers that have been registered. In a few cases there are exceptions to this rule, and you should refer to the method explanations and notes for further details.

 Name   Short Description 
Adding Event Handlers
addMetaEventHandler Adds an event handler for a specific meta event type and value pair.
addOnAudibleStateChange Adds an event handler to a Music Object instance's list of audible state change event handlers.
addOnLoad Adds an event handler to a Music Object instance's list of load event handlers.
addOnMetaEvent Adds an event handler to a Music Object instance's list of meta event handlers.
addOnOutputVolumeChange Adds an event handler to a Music Object instance's list of output volume change event handlers.
addOnPause Adds an event handler to a Music Object instance's list of pause event handlers.
addOnPlay Adds an event handler to a Music Object instance's list of play event handlers.
addOnReady Adds an event handler to a Music Object instance's list of ready event handlers.
addOnStop Adds an event handler to a Music Object instance's list of stop event handlers.
Clearing Event Handlers
clearCallbacks Clears all callbacks that have been assigned to a Music Object instance.
clearOnAudibleStateChange Clears all handlers assigned to the audible state change event of a Music Object instance.
clearOnLoad Clears all handlers assigned to the load event of a Music Object instance.
clearOnMetaEvent Clears all handlers assigned to the meta event of a Music Object instance.
clearOnOutputVolumeChange Clears all handlers assigned to the output volume change event of a Music Object instance.
clearOnPause Clears all handlers assigned to the pause event of a Music Object instance.
clearOnPlay Clears all handlers assigned to the play event of a Music Object instance.
clearOnReady Clears all handlers assigned to the ready event of a Music Object instance.
clearOnStop Clears all handlers assigned to the stop event of a Music Object instance.
Removing Event Handlers
removeCallbackHandlers Removes the specified callback handler (or handlers) from the specified instance callback type (or types).
Music.removeCallbackHandlers Removes the specified callback handler (or handlers) from the specified static callback type (or types).
removeMetaEventHandlers Removes one or more handlers for specific meta event type and value pairs.
removeOnAudibleStateChange Removes a specified handler from a Music Object instance's list of audible state change event handlers.
removeOnLoad Removes a specified handler from a Music Object instance's list of load event handlers.
removeOnMetaEvent Removes a specified handler from a Music Object instance's list of meta event handlers.
removeOnOutputVolumeChange Removes a specified handler from a Music Object instance's list of output volume change event handlers.
removeOnPause Removes a specified handler from a Music Object instance's list of pause event handlers.
removeOnPlay Removes a specified handler from a Music Object instance's list of play event handlers.
removeOnReady Removes a specified handler from a Music Object instance's list of ready event handlers.
removeOnStop Removes a specified handler from a Music Object instance's list of stop event handlers.

Adding Event Handlers

 addMetaEventHandler

 
 CATEGORY   Instance Method 
 MODULE   Music Object Extension - Callbacks 
 Min. Player Version   1.3.0 
 File Types Supported   RMF, MIDI 
 

The addMetaEventHandler instance method lets one add event handlers for specific meta events that are encountered within an RMF or MIDI file.

SYNTAX    addMetaEventHandler ( MetaEventTypeSTR , MetaEventValueSTR , HandlerFunction )

Unique meta events are identified by their meta event type and meta event value, as specified by the MetaEventTypeSTR and MetaEventValueSTR parameters, respectively. So, rather than registering a generalized handler using the onMetaEvent or addOnMetaEvent methods and then writing your own code for the handler to detect specific meta events that you care about, you can instead let this extension do some of this hard work for you by registering handlers for the specific events that you care about.

For instance, if you wanted to be notified each time an RMF composition reached the beginning of a fade out at the end of the composition, and assuming that the composition contains a marker meta event at the start of this fade out, then one could use the following code to register the handler for this unique meta event...

function musicFadeOutBegins () {
   // code to change UI to reflect fade out
}

myMusicObject.addMetaEventHandler ('Marker','Fade to end',musicFadeOutBegins);

VARIATIONS
NOTES
 addOnAudibleStateChange

 
 CATEGORY   Instance Method 
 MODULE   Music Object Extension - Callbacks 
 Min. Player Version   1.3.0 
 File Types Supported   RMF, MIDI, WAV, AIFF, AU 
 

The addOnAudibleStateChange instance method lets you add an event handler to a Music Object instance's list of audible state change event handlers.

SYNTAX    addOnAudibleStateChange ( HandlerFunction )

The addOnAudibleStateChange method is similar to the onAudibleStateChange method in that it lets you register handlers for the audible state change event of a Music Object instance. The key difference is that, while the onAudibleStateChange method only lets you register one handler for the audible state change event and overrides any existing registered handler, the addOnAudibleStateChange method instead lets you add to a stack of event handlers for the audible state change event. When an audible state change event occurs for a Music Object instance, all handlers that have been added to the stack using the addOnAudibleStateChange method will be executed in the order in which they were added to the stack.

For backward compatibility reasons, handlers registered for the audible state change event using this method do not override a handler registered using the core Music Object API's onAudibleStateChange method. Any handler registered for the audible state change event using the onAudibleStateChange method is executed before any handlers that have been added to the handler stack using the addOnAudibleStateChange method.

VARIATIONS
NOTES
 addOnLoad

 
 CATEGORY   Instance Method 
 MODULE   Music Object Extension - Callbacks 
 Min. Player Version   1.0.0 
 File Types Supported   RMF, MIDI, WAV, AIFF, AU 
 

The addOnLoad instance method lets you add an event handler to a Music Object instance's list of load event handlers.

SYNTAX    addOnLoad ( HandlerFunction )

The addOnLoad method is similar to the onLoad method in that it lets you register handlers for the load event of a Music Object instance. The key difference is that, while the onLoad method only lets you register one handler for the load event and overrides any existing registered handler, the addOnLoad method instead lets you add to a stack of event handlers for the load event. When a load event occurs for a Music Object instance, all handlers that have been added to the stack using the addOnLoad method will be executed in the order in which they were added to the stack.

For backward compatibility reasons, handlers registered for the load event using this method do not override a handler registered using the core Music Object API's onLoad method. Any handler registered for the load event using the onLoad method is executed before any handlers that have been added to the handler stack using the addOnLoad method.

VARIATIONS
NOTES
 addOnMetaEvent

 
 CATEGORY   Instance Method 
 MODULE   Music Object Extension - Callbacks 
 Min. Player Version   1.3.0 
 File Types Supported   RMF, MIDI 
 

The addOnMetaEvent instance method lets you add an event handler to a Music Object instance's list of meta event handlers.

SYNTAX    addOnMetaEvent ( HandlerFunction )

The addOnMetaEvent method is similar to the onMetaEvent method in that it lets you register handlers for the meta event of a Music Object instance. The key difference is that, while the onMetaEvent method only lets you register one handler for the meta event and overrides any existing registered handler, the addOnMetaEvent method instead lets you add to a stack of event handlers for the meta event. When a meta event occurs for a Music Object instance, all handlers that have been added to the stack using the addOnMetaEvent method will be executed in the order in which they were added to the stack.

For backward compatibility reasons, handlers registered for the meta event using this method do not override a handler registered using the core Music Object API's onMetaEvent method. Any handler registered for the meta event using the onMetaEvent method is executed before any handlers that have been added to the handler stack using the addOnMetaEvent method.

NOTES
 addOnOutputVolumeChange

 
 CATEGORY   Instance Method 
 MODULE   Music Object Extension - Callbacks 
 Min. Player Version   1.3.0 
 File Types Supported   RMF, MIDI, WAV, AIFF, AU 
 

The addOnOutputVolumeChange instance method lets you add an event handler to a Music Object instance's list of output volume change event handlers.

SYNTAX    addOnOutputVolumeChange ( HandlerFunction )

The addOnOutputVolumeChange method is similar to the onOutputVolumeChange method in that it lets you register handlers for the output volume change event of a Music Object instance. The key difference is that, while the onOutputVolumeChange method only lets you register one handler for the output volume change event and overrides any existing registered handler, the addOnOutputVolumeChange method instead lets you add to a stack of event handlers for the output volume change event. When an output volume change event occurs for a Music Object instance, all handlers that have been added to the stack using the addOnOutputVolumeChange method will be executed in the order in which they were added to the stack.

For backward compatibility reasons, handlers registered for the output volume change event using this method do not override a handler registered using the core Music Object API's onOutputVolumeChange method. Any handler registered for the output volume change event using the onOutputVolumeChange method is executed before any handlers that have been added to the handler stack using the addOnOutputVolumeChange method.

VARIATIONS
NOTES
 addOnPause

 
 CATEGORY   Instance Method 
 MODULE   Music Object Extension - Callbacks 
 Min. Player Version   1.3.0 
 File Types Supported   RMF, MIDI, WAV, AIFF, AU 
 

The addOnPause instance method lets you add an event handler to a Music Object instance's list of pause event handlers.

SYNTAX    addOnPause ( HandlerFunction )

The addOnPause method is similar to the onPause method in that it lets you register handlers for the pause event of a Music Object instance. The key difference is that, while the onPause method only lets you register one handler for the pause event and overrides any existing registered handler, the addOnPause method instead lets you add to a stack of event handlers for the pause event. When a pause event occurs for a Music Object instance, all handlers that have been added to the stack using the addOnPause method will be executed in the order in which they were added to the stack.

For backward compatibility reasons, handlers registered for the pause event using this method do not override a handler registered using the core Music Object API's onPause method. Any handler registered for the pause event using the onPause method is executed before any handlers that have been added to the handler stack using the addOnPause method.

VARIATIONS
NOTES
 addOnPlay

 
 CATEGORY   Instance Method 
 MODULE   Music Object Extension - Callbacks 
 Min. Player Version   1.3.0 
 File Types Supported   RMF, MIDI, WAV, AIFF, AU 
 

The addOnPlay instance method lets you add an event handler to a Music Object instance's list of play event handlers.

SYNTAX    addOnPlay ( HandlerFunction )

The addOnPlay method is similar to the onPlay method in that it lets you register handlers for the play event of a Music Object instance. The key difference is that, while the onPlay method only lets you register one handler for the play event and overrides any existing registered handler, the addOnPlay method instead lets you add to a stack of event handlers for the play event. When a play event occurs for a Music Object instance, all handlers that have been added to the stack using the addOnPlay method will be executed in the order in which they were added to the stack.

For backward compatibility reasons, handlers registered for the play event using this method do not override a handler registered using the core Music Object API's onPlay method. Any handler registered for the play event using the onPlay method is executed before any handlers that have been added to the handler stack using the addOnPlay method.

VARIATIONS
NOTES
 addOnReady

 
 CATEGORY   Instance Method 
 MODULE   Music Object Extension - Callbacks 
 Min. Player Version   1.0.0 
 File Types Supported   RMF, MIDI, WAV, AIFF, AU 
 

The addOnReady instance method lets you add an event handler to a Music Object instance's list of ready event handlers.

SYNTAX    addOnReady ( HandlerFunction )

The addOnReady method is similar to the onReady method in that it lets you register handlers for the ready event of a Music Object instance. The key difference is that, while the onReady method only lets you register one handler for the ready event and overrides any existing registered handler, the addOnReady method instead lets you add to a stack of event handlers for the ready event. When a ready event occurs for a Music Object instance, all handlers that have been added to the stack using the addOnReady method will be executed in the order in which they were added to the stack.

For backward compatibility reasons, handlers registered for the ready event using this method do not override a handler registered using the core Music Object API's onReady method. Any handler registered for the ready event using the onReady method is executed before any handlers that have been added to the handler stack using the addOnReady method.

VARIATIONS
NOTES
 addOnStop

 
 CATEGORY   Instance Method 
 MODULE   Music Object Extension - Callbacks 
 Min. Player Version   1.3.0 
 File Types Supported   RMF, MIDI, WAV, AIFF, AU 
 

The addOnStop instance method lets you add an event handler to a Music Object instance's list of stop event handlers.

SYNTAX    addOnStop ( HandlerFunction )

The addOnStop method is similar to the onStop method in that it lets you register handlers for the stop event of a Music Object instance. The key difference is that, while the onStop method only lets you register one handler for the stop event and overrides any existing registered handler, the addOnStop method instead lets you add to a stack of event handlers for the stop event. When a stop event occurs for a Music Object instance, all handlers that have been added to the stack using the addOnStop method will be executed in the order in which they were added to the stack.

For backward compatibility reasons, handlers registered for the stop event using this method do not override a handler registered using the core Music Object API's onStop method. Any handler registered for the stop event using the onStop method is executed before any handlers that have been added to the handler stack using the addOnStop method.

VARIATIONS
NOTES
Clearing Event Handlers

 clearCallbacks

 
 CATEGORY   Instance Method 
 MODULE   Music Object Extension - Callbacks 
 Min. Player Version   1.0.0 
 File Types Supported   RMF, MIDI, WAV, AIFF, AU 
 

The clearCallbacks instance method lets you clear all callbacks that have been assigned to a Music Object instance.

SYNTAX    clearCallbacks ( )

The clearCallbacks method clears all callbacks that have been registered for the Music Object instance. This includes callbacks registered using the core Music Object API's onLoad, onMetaEvent, onPause, onPlay, onReady, and onStop methods, as well as this extension's addMetaEventHandler, addOnLoad, addOnMetaEvent, addOnPause, addOnPlay, addOnReady, and addOnStop methods. If you do not wish to affect handlers registered using the core Music Object API's callback methods, then you should use the removeCallbackHandlers method.

NOTES
 clearOnAudibleStateChange

 
 CATEGORY   Instance Method 
 MODULE   Music Object Extension - Callbacks 
 Min. Player Version   1.3.0 
 File Types Supported   RMF, MIDI, WAV, AIFF, AU 
 

The clearOnAudibleStateChange instance method lets you clear all handlers assigned to the audible state change event of a Music Object instance.

SYNTAX    clearOnAudibleStateChange ( )

The clearOnAudibleStateChange method clears all handlers that have been added for the audible state change event using this extension's addOnAudibleStateChange method, as well as the core Music Object API's addCallbackHandler and onAudibleStateChange methods. To remove only those handlers that have been added using the addOnAudibleStateChange or addCallbackHandler methods, use the variation of the removeOnAudibleStateChange method that takes no parameters, as in the statement myMusicObject.removeOnAudibleStateChange ( ). It should be noted that using the statement onAudibleStateChange (null) to clear a handler that has been registered for the audible state change event using the onAudibleStateChange method has no effect on handlers that have been registered using the addOnAudibleStateChange or addCallbackHandler methods.

NOTES
 clearOnLoad

 
 CATEGORY   Instance Method 
 MODULE   Music Object Extension - Callbacks 
 Min. Player Version   1.0.0 
 File Types Supported   RMF, MIDI, WAV, AIFF, AU 
 

The clearOnLoad instance method lets you clear all handlers assigned to the load event of a Music Object instance.

SYNTAX    clearOnLoad ( )

The clearOnLoad method clears all handlers that have been added for the load event using this extension's addOnLoad method, as well as the core Music Object API's addCallbackHandler and onLoad methods. To remove only those handlers that have been added using the addOnLoad or addCallbackHandler methods, use the variation of the removeOnPlay method that takes no parameters, as in the statement myMusicObject.removeOnPlay ( ). It should be noted that using the statement onLoad (null) to clear a handler that has been registered for the load event using the onLoad method has no effect on handlers that have been registered using the addOnLoad or addCallbackHandler methods.

NOTES
 clearOnMetaEvent

 
 CATEGORY   Instance Method 
 MODULE   Music Object Extension - Callbacks 
 Min. Player Version   1.3.0 
 File Types Supported   RMF, MIDI 
 

The clearOnMetaEvent instance method lets you clear all handlers assigned to the meta event of a Music Object instance.

SYNTAX    clearOnMetaEvent ( )

The clearOnMetaEvent method clears all handlers that have been added for the meta event using this extension's addOnMetaEvent method, as well as the core Music Object API's addCallbackHandler and onMetaEvent methods. To remove only those handlers that have been added using the addOnMetaEvent or addCallbackHandler methods, use the variation of the removeOnPlay method that takes no parameters, as in the statement myMusicObject.removeOnPlay ( ). It should be noted that using the statement onMetaEvent (null) to clear a handler that has been registered for the meta event using the onMetaEvent method has no effect on handlers that have been registered using the addOnMetaEvent or addCallbackHandler methods.

NOTES
 clearOnOutputVolumeChange

 
 CATEGORY   Instance Method 
 MODULE   Music Object Extension - Callbacks 
 Min. Player Version   1.3.0 
 File Types Supported   RMF, MIDI, WAV, AIFF, AU 
 

The clearOnOutputVolumeChange instance method lets you clear all handlers assigned to the output volume change event of a Music Object instance.

SYNTAX    clearOnOutputVolumeChange ( )

The clearOnOutputVolumeChange method clears all handlers that have been added for the output volume change event using this extension's addOnOutputVolumeChange method, as well as the core Music Object API's addCallbackHandler and onOutputVolumeChange methods. To remove only those handlers that have been added using the addOnOutputVolumeChange or addCallbackHandler methods, use the variation of the removeOnOutputVolumeChange method that takes no parameters, as in the statement myMusicObject.removeOnOutputVolumeChange ( ). It should be noted that using the statement onOutputVolumeChange (null) to clear a handler that has been registered for the output volume change event using the onOutputVolumeChange method has no effect on handlers that have been registered using the addOnOutputVolumeChange or addCallbackHandler methods.

NOTES
 clearOnPause

 
 CATEGORY   Instance Method 
 MODULE   Music Object Extension - Callbacks 
 Min. Player Version   1.3.0 
 File Types Supported   RMF, MIDI, WAV, AIFF, AU 
 

The clearOnPause instance method lets you clear all handlers assigned to the pause event of a Music Object instance.

SYNTAX    clearOnPause ( )

The clearOnPause method clears all handlers that have been added for the pause event using this extension's addOnPause method, as well as the core Music Object API's addCallbackHandler and onPause methods. To remove only those handlers that have been added using the addOnPause or addCallbackHandler methods, use the variation of the removeOnPlay method that takes no parameters, as in the statement myMusicObject.removeOnPlay ( ). It should be noted that using the statement onPause (null) to clear a handler that has been registered for the pause event using the onPause method has no effect on handlers that have been registered using the addOnPause or addCallbackHandler methods.

NOTES
 clearOnPlay

 
 CATEGORY   Instance Method 
 MODULE   Music Object Extension - Callbacks 
 Min. Player Version   1.3.0 
 File Types Supported   RMF, MIDI, WAV, AIFF, AU 
 

The clearOnPlay instance method lets you clear all handlers assigned to the play event of a Music Object instance.

SYNTAX    clearOnPlay ( )

The clearOnPlay method clears all handlers that have been added for the play event using this extension's addOnPlay method, as well as the core Music Object API's addCallbackHandler and onPlay methods. To remove only those handlers that have been added using the addOnPlay or addCallbackHandler methods, use the variation of the removeOnPlay method that takes no parameters, as in the statement myMusicObject.removeOnPlay ( ). It should be noted that using the statement onPlay (null) to clear a handler that has been registered for the play event using the onPlay method has no effect on handlers that have been registered using the addOnPlay or addCallbackHandler methods.

NOTES
 clearOnReady

 
 CATEGORY   Instance Method 
 MODULE   Music Object Extension - Callbacks 
 Min. Player Version   1.0.0 
 File Types Supported   RMF, MIDI, WAV, AIFF, AU 
 

The clearOnReady instance method lets you clear all handlers assigned to the ready event of a Music Object instance.

SYNTAX    clearOnReady ( )

The clearOnReady method clears all handlers that have been added for the ready event using this extension's addOnReady method, as well as the core Music Object API's addCallbackHandler and onReady methods. To remove only those handlers that have been added using the addOnReady or addCallbackHandler methods, use the variation of the removeOnPlay method that takes no parameters, as in the statement myMusicObject.removeOnPlay ( ). It should be noted that using the statement onReady (null) to clear a handler that has been registered for the ready event using the onReady method has no effect on handlers that have been registered using the addOnReady or addCallbackHandler methods.

NOTES
 clearOnStop

 
 CATEGORY   Instance Method 
 MODULE   Music Object Extension - Callbacks 
 Min. Player Version   1.3.0 
 File Types Supported   RMF, MIDI, WAV, AIFF, AU 
 

The clearOnStop instance method lets you clear all handlers assigned to the stop event of a Music Object instance.

SYNTAX    clearOnStop ( )

The clearOnStop method clears all handlers that have been added for the stop event using this extension's addOnStop method, as well as the core Music Object API's addCallbackHandler and onStop methods. To remove only those handlers that have been added using the addOnStop or addCallbackHandler methods, use the variation of the removeOnPlay method that takes no parameters, as in the statement myMusicObject.removeOnPlay ( ). It should be noted that using the statement onStop (null) to clear a handler that has been registered for the stop event using the onStop method has no effect on handlers that have been registered using the addOnStop or addCallbackHandler methods.

NOTES
Removing Event Handlers

 removeCallbackHandlers

 
 CATEGORY   Instance Method 
 MODULE   Music Object Extension - Callbacks 
 Min. Player Version   1.0.0 
 File Types Supported   RMF, MIDI, WAV, AIFF, AU 
 

The removeCallbackHandlers instance method lets you remove the specified callback handler (or handlers) from the specified instance callback type (or types).

SYNTAX    removeCallbackHandlers ( InstanceCallbackTypeSTR , HandlerFunction )

The removeCallbackHandlers method lets you remove a specific callback handler from the stack of handlers that have been registered for the specified instance callback type. This is equivalent to using some of the other methods in this extension, such as removeOnLoad, removeOnMetaEvent, removeOnPause, removeOnPlay, removeOnReady, and removeOnStop. For instance, the statement myMusicObject.removeCallbackHandlers ('onPlay',myOnPlayHandler) is equivalent to the statement myMusicObject.removeOnPlay (myOnPlayHandler).

In order to successfully remove a specific handler using the removeCallbackHandlers method, one must correctly specify the callback type and the callback handler that were used when initially registering the callback handler. For example, in order the remove the handler registered using the statement myMusicObject.addCallbackHandler ('onPlay',myOnPlayHandler), one should use the statement myMusicObject.removeCallbackHandlers ('onPlay',myOnPlayHandler). In this example, using the statement myMusicObject.removeCallbackHandlers ('onPlay','myOnPlayHandler ()') would be incorrect and would not remove the handler, since the original statement that registered the callback handler registered it using the Function type to specify the handler, and not the String type.

It is also possible to remove all handlers that have been added for a specific callback type by simply not specifying the handler to be removed, as in the example statement myMusicObject.removeCallbackHandlers ('onPlay'), which will remove all handlers that were added using the addOnPlay or addCallbackHandler methods. This is equivalent to the statement myMusicObject.removeOnPlay ().

Finally, one can remove all instance callback handlers that have been added using the methods in this extension by simply not specifying the instance callback type or handler, as in the statement myMusicObject.removeCallbackHandlers ().

VARIATIONS
NOTES
 Music.removeCallbackHandlers

 
 CATEGORY   Static Method 
 MODULE   Music Object Extension - Callbacks 
 Min. Player Version   1.0.0 
 

The Music.removeCallbackHandlers static method lets you remove the specified callback handler (or handlers) from the specified static callback type (or types).

SYNTAX    Music.removeCallbackHandlers ( StaticCallbackTypeSTR , HandlerFunction )

The Music.removeCallbackHandlers method lets you remove a specific callback handler from the stack of handlers that have been registered for the specified static callback type. This allows one to remove callback handlers from a static callback type where no dedicated static method has been provided for removing handlers from that callback. For example, while there is no static method provided for removing handlers from the onAudioEngagedChange static callback, one can remove handlers from this callback using the Music.removeCallbackHandlers method and specifying the string value "onAudioEngagedChange" for the StaticCallbackTypeSTR parameter.

In order to successfully remove a specific handler using the Music.removeCallbackHandlers method, one must correctly specify the callback type and the callback handler that were used when initially registering the callback handler. For example, in order the remove the handler registered using the statement Music.addCallbackHandler ('onAudioEngagedChange',myOnAudioEngagedChangeHandler), one should use the statement Music.removeCallbackHandlers ('onAudioEngagedChange',myOnAudioEngagedChangeHandler). In this example, using the statement myMusicObject.removeCallbackHandlers ('onAudioEngagedChange','myOnAudioEngagedChangeHandler ()') would be incorrect and would not remove the handler, since the original statement that registered the callback handler registered it using the Function type to specify the handler, and not the String type.

It is also possible to remove all handlers that have been added for a specific callback type by simply not specifying the handler to be removed, as in the example statement Music.removeCallbackHandlers ('onAudioEngagedChange'), which will remove all handlers that were added to the onAudioEngagedChange static callback type.

Finally, one can remove all static callback handlers that have been added using the methods in this extension by simply not specifying the static callback type or handler, as in the statement Music.removeCallbackHandlers ().

VARIATIONS
NOTES
 removeMetaEventHandlers

 
 CATEGORY   Instance Method 
 MODULE   Music Object Extension - Callbacks 
 Min. Player Version   1.3.0 
 File Types Supported   RMF, MIDI 
 

The removeMetaEventHandlers instance method lets you remove one or more handlers for specific meta event type and value pairs.

SYNTAX    removeMetaEventHandlers ( MetaEventTypeSTR , MetaEventValueSTR , HandlerFunction )

The removeMetaEventHandlers method lets one remove a handler for a specific meta event that was added using the addMetaEventHandler method. To remove a handler for a specific meta event, one must correctly specify the meta event type, meta event value, and handler parameters that were used when originally registering the handler. For instance to remove a meta event handler that was added using the statement...

myMusicObject.addMetaEventHandler ('Marker','Fade to end',musicFadeOutBegins);

...one should use the statement...

myMusicObject.removeMetaEventHandlers ('Marker','Fade to end',musicFadeOutBegins);

It is possible to remove all handlers that are assigned to a specific meta event type / value by simply not specifying the handler, as in the statement myMusicObject.removeMetaEventHandlers ('Marker','Fade to end'). Furthermore, one can remove all handlers for a specific type of meta event, such as a "Marker" event, by not specifying the meta event value and handler parameters, as in the statement myMusicObject.removeMetaEventHandlers ('Marker'). Finally, one can remove all handlers for meta events that were added using the addMetaEventHandlers method by simply not specifying any parameters for this method, as in the statement myMusicObject.removeMetaEventHandlers ().

VARIATIONS
NOTES
 removeOnAudibleStateChange

 
 CATEGORY   Instance Method 
 MODULE   Music Object Extension - Callbacks 
 Min. Player Version   1.0.0 
 File Types Supported   RMF, MIDI, WAV, AIFF, AU 
 

The removeOnAudibleStateChange instance method lets you remove a specified handler from a Music Object instance's list of audible state change event handlers.

SYNTAX    removeOnAudibleStateChange ( HandlerFunction )

The removeOnAudibleStateChange method lets one remove a specific handler that was added for the audible state change event using this extension's addOnAudibleStateChange method or the core Music Object API's addCallbackHandler method.

In order to successfully remove a handler for the audible state change event that has been added using the methods in this extension, one must correctly specify the handler that was used when originally registering the handler. For instance, in order to remove a handler that was added using the statement myMusicObject.addOnAudibleStateChange (myOnAudibleStateChangeHandler), one should use the statement myMusicObject.removeOnAudibleStateChange (myOnAudibleStateChangeHandler). In this example, using the statement myMusicObject.removeOnAudibleStateChange ('myOnAudibleStateChangeHandler ()') would be incorrect and would not remove the handler, since the original statement that registered the callback handler registered it using the Function type to specify the handler, and not the String type.

For backward compatibility reasons, this method does not affect a handler that has been registered for the audible state change event using the core Music Object API's onAudibleStateChange method. Similarly, using the statement OnAudibleStateChange (null) to clear a handler that has been registered for the audible state change event using the onAudibleStateChange method has no effect on handlers that have been registered using the addOnAudibleStateChange or addCallbackHandler methods.

VARIATIONS
NOTES
 removeOnLoad

 
 CATEGORY   Instance Method 
 MODULE   Music Object Extension - Callbacks 
 Min. Player Version   1.0.0 
 File Types Supported   RMF, MIDI, WAV, AIFF, AU 
 

The removeOnLoad instance method lets you remove a specified handler from a Music Object instance's list of load event handlers.

SYNTAX    removeOnLoad ( HandlerFunction )

The removeOnLoad method lets one remove a specific handler that was added for the load event using this extension's addOnLoad method or the core Music Object API's addCallbackHandler method.

In order to successfully remove a handler for the load event that has been added using the methods in this extension, one must correctly specify the handler that was used when originally registering the handler. For instance, in order to remove a handler that was added using the statement myMusicObject.addOnLoad (myOnLoadHandler), one should use the statement myMusicObject.removeOnLoad (myOnLoadHandler). In this example, using the statement myMusicObject.removeOnLoad ('myOnLoadHandler ()') would be incorrect and would not remove the handler, since the original statement that registered the callback handler registered it using the Function type to specify the handler, and not the String type.

For backward compatibility reasons, this method does not affect a handler that has been registered for the load event using the core Music Object API's onLoad method. Similarly, using the statement onLoad (null) to clear a handler that has been registered for the load event using the onLoad method has no effect on handlers that have been registered using the addOnLoad or addCallbackHandler methods.

VARIATIONS
NOTES
 removeOnMetaEvent

 
 CATEGORY   Instance Method 
 MODULE   Music Object Extension - Callbacks 
 Min. Player Version   1.3.0 
 File Types Supported   RMF, MIDI 
 

The removeOnMetaEvent instance method lets you remove a specified handler from a Music Object instance's list of meta event handlers.

SYNTAX    removeOnMetaEvent ( HandlerFunction )

The removeOnMetaEvent method lets one remove a specific handler that was added for the meta event using this extension's addOnMetaEvent method or the core Music Object API's addCallbackHandler method.

In order to successfully remove a handler for the meta event that has been added using the methods in this extension, one must correctly specify the handler that was used when originally registering the handler. For instance, in order to remove a handler that was added using the statement myMusicObject.addOnMetaEvent (myOnMetaEventHandler), one should use the statement myMusicObject.removeOnMetaEvent (myOnMetaEventHandler). In this example, using the statement myMusicObject.removeOnMetaEvent ('myOnMetaEventHandler ()') would be incorrect and would not remove the handler, since the original statement that registered the callback handler registered it using the Function type to specify the handler, and not the String type.

For backward compatibility reasons, this method does not affect a handler that has been registered for the meta event using the core Music Object API's onMetaEvent method. Similarly, using the statement onMetaEvent (null) to clear a handler that has been registered for the meta event using the onMetaEvent method has no effect on handlers that have been registered using the addOnMetaEvent or addCallbackHandler methods.

VARIATIONS
NOTES
 removeOnOutputVolumeChange

 
 CATEGORY   Instance Method 
 MODULE   Music Object Extension - Callbacks 
 Min. Player Version   1.0.0 
 File Types Supported   RMF, MIDI, WAV, AIFF, AU 
 

The removeOnOutputVolumeChange instance method lets you remove a specified handler from a Music Object instance's list of output volume change event handlers.

SYNTAX    removeOnOutputVolumeChange ( HandlerFunction )

The removeOnOutputVolumeChange method lets one remove a specific handler that was added for the output volume change event using this extension's addOnOutputVolumeChange method or the core Music Object API's addCallbackHandler method.

In order to successfully remove a handler for the output volume change event that has been added using the methods in this extension, one must correctly specify the handler that was used when originally registering the handler. For instance, in order to remove a handler that was added using the statement myMusicObject.addOnOutputVolumeChange (myOnOutputVolumeChangeHandler), one should use the statement myMusicObject.removeOnOutputVolumeChange (myOnOutputVolumeChangeHandler). In this example, using the statement myMusicObject.removeOnOutputVolumeChange ('myOnOutputVolumeChangeHandler ()') would be incorrect and would not remove the handler, since the original statement that registered the callback handler registered it using the Function type to specify the handler, and not the String type.

For backward compatibility reasons, this method does not affect a handler that has been registered for the output volume change event using the core Music Object API's onOutputVolumeChange method. Similarly, using the statement onOutputVolumeChange (null) to clear a handler that has been registered for the output volume change event using the onOutputVolumeChange method has no effect on handlers that have been registered using the addOnOutputVolumeChange or addCallbackHandler methods.

VARIATIONS
NOTES
 removeOnPause

 
 CATEGORY   Instance Method 
 MODULE   Music Object Extension - Callbacks 
 Min. Player Version   1.3.0 
 File Types Supported   RMF, MIDI, WAV, AIFF, AU 
 

The removeOnPause instance method lets you remove a specified handler from a Music Object instance's list of pause event handlers.

SYNTAX    removeOnPause ( HandlerFunction )

The removeOnPause method lets one remove a specific handler that was added for the pause event using this extension's addOnPause method or the core Music Object API's addCallbackHandler method.

In order to successfully remove a handler for the pause event that has been added using the methods in this extension, one must correctly specify the handler that was used when originally registering the handler. For instance, in order to remove a handler that was added using the statement myMusicObject.addOnPause (myOnPauseHandler), one should use the statement myMusicObject.removeOnPause (myOnPauseHandler). In this example, using the statement myMusicObject.removeOnPause ('myOnPauseHandler ()') would be incorrect and would not remove the handler, since the original statement that registered the callback handler registered it using the Function type to specify the handler, and not the String type.

For backward compatibility reasons, this method does not affect a handler that has been registered for the pause event using the core Music Object API's onPause method. Similarly, using the statement onPause (null) to clear a handler that has been registered for the pause event using the onPause method has no effect on handlers that have been registered using the addOnPause or addCallbackHandler methods.

VARIATIONS
NOTES
 removeOnPlay

 
 CATEGORY   Instance Method 
 MODULE   Music Object Extension - Callbacks 
 Min. Player Version   1.3.0 
 File Types Supported   RMF, MIDI, WAV, AIFF, AU 
 

The removeOnPlay instance method lets you remove a specified handler from a Music Object instance's list of play event handlers.

SYNTAX    removeOnPlay ( HandlerFunction )

The removeOnPlay method lets one remove a specific handler that was added for the play event using this extension's addOnPlay method or the core Music Object API's addCallbackHandler method.

In order to successfully remove a handler for the play event that has been added using the methods in this extension, one must correctly specify the handler that was used when originally registering the handler. For instance, in order to remove a handler that was added using the statement myMusicObject.addOnPlay (myOnPlayHandler), one should use the statement myMusicObject.removeOnPlay (myOnPlayHandler). In this example, using the statement myMusicObject.removeOnPlay ('myOnPlayHandler ()') would be incorrect and would not remove the handler, since the original statement that registered the callback handler registered it using the Function type to specify the handler, and not the String type.

For backward compatibility reasons, this method does not affect a handler that has been registered for the play event using the core Music Object API's onPlay method. Similarly, using the statement onPlay (null) to clear a handler that has been registered for the play event using the onPlay method has no effect on handlers that have been registered using the addOnPlay or addCallbackHandler methods.

VARIATIONS
NOTES
 removeOnReady

 
 CATEGORY   Instance Method 
 MODULE   Music Object Extension - Callbacks 
 Min. Player Version   1.0.0 
 File Types Supported   RMF, MIDI, WAV, AIFF, AU 
 

The removeOnReady instance method lets you remove a specified handler from a Music Object instance's list of ready event handlers.

SYNTAX    removeOnReady ( HandlerFunction )

The removeOnReady method lets one remove a specific handler that was added for the ready event using this extension's addOnReady method or the core Music Object API's addCallbackHandler method.

In order to successfully remove a handler for the ready event that has been added using the methods in this extension, one must correctly specify the handler that was used when originally registering the handler. For instance, in order to remove a handler that was added using the statement myMusicObject.addOnReady (myOnReadyHandler), one should use the statement myMusicObject.removeOnReady (myOnReadyHandler). In this example, using the statement myMusicObject.removeOnReady ('myOnReadyHandler ()') would be incorrect and would not remove the handler, since the original statement that registered the callback handler registered it using the Function type to specify the handler, and not the String type.

For backward compatibility reasons, this method does not affect a handler that has been registered for the ready event using the core Music Object API's onReady method. Similarly, using the statement onReady (null) to clear a handler that has been registered for the ready event using the onReady method has no effect on handlers that have been registered using the addOnReady or addCallbackHandler methods.

VARIATIONS
NOTES
 removeOnStop

 
 CATEGORY   Instance Method 
 MODULE   Music Object Extension - Callbacks 
 Min. Player Version   1.3.0 
 File Types Supported   RMF, MIDI, WAV, AIFF, AU 
 

The removeOnStop instance method lets you remove a specified handler from a Music Object instance's list of stop event handlers.

SYNTAX    removeOnStop ( HandlerFunction )

The removeOnStop method lets one remove a specific handler that was added for the stop event using this extension's addOnStop method or the core Music Object API's addCallbackHandler method.

In order to successfully remove a handler for the stop event that has been added using the methods in this extension, one must correctly specify the handler that was used when originally registering the handler. For instance, in order to remove a handler that was added using the statement myMusicObject.addOnStop (myOnStopHandler), one should use the statement myMusicObject.removeOnStop (myOnStopHandler). In this example, using the statement myMusicObject.removeOnStop ('myOnStopHandler ()') would be incorrect and would not remove the handler, since the original statement that registered the callback handler registered it using the Function type to specify the handler, and not the String type.

For backward compatibility reasons, this method does not affect a handler that has been registered for the stop event using the core Music Object API's onStop method. Similarly, using the statement onStop (null) to clear a handler that has been registered for the stop event using the onStop method has no effect on handlers that have been registered using the addOnStop or addCallbackHandler methods.

VARIATIONS
NOTES